package leetcode.offer;

import org.junit.Test;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2021/11/12
 */
public class offer53 {


    @Test
    public void test() {
        int[] array = {2, 3, 1, 0, 2, 5, 3};
    }

    public int search(int[] nums, int target) {
        int count = 0;
        for (int num : nums) {
            if(target==num) {
                count += 1;
            }
        }
        return count;

    }

    public int missingNumber(int[] nums) {
        if(nums.length==1 && nums[0]==0) return 1;
        int num = nums[nums.length-1];
        for (int i = 0; i < num; i++) {
            if(nums[i]!=i){
                return i;
            }
        }
        return nums[nums.length-1]+1;
    }
}
